#pragma once
#include "Globals.h"
#include <vector>



static D3DCOLOR cNeutral = D3DCOLOR_ARGB(255,255,255,255);
static D3DCOLOR cP1Color = D3DCOLOR_ARGB(255,255,0,255);
static D3DCOLOR cP2Color = D3DCOLOR_ARGB(255,0,0,255);

class BaseDrawable
{
protected:

	//Logic Properties
	int				miOwner;				//Which Player Controls the Piece	
	int				meiDirIndex;			//Enumeration Direction Index
	int				meiObjIndex;			//Enumerated Object Index

	//Turn Properties
	bool    MovedThisTurn;
	bool    RotatedThisTurn;
	bool	Visible;

	//Display Properties
	DWORD			Subset;
	D3DCOLOR		mvColor;
	D3DXVECTOR3		mvsPosition;
	D3DXVECTOR3		mvPosition;
	D3DXVECTOR3		mvsRotation;
	D3DXVECTOR3		mvRotation;

	//STRUCTORS
	BaseDrawable(){};
	BaseDrawable(int,D3DXVECTOR3);
	

	//=====MUTATORS
	bool SetOwner(int i);
	void RefreshColors();

	//Rotation - !Called except in constructors & rotators
	void InitialRotate(int D);	//Called to set up original rotation.
	void UpdateRotation(bool);	//Called to reorient mbRefractions

public:
	BaseDrawable(int Obj,D3DXVECTOR3 V,int Dir,int Own)
		:meiObjIndex(Obj), 
		mvPosition(V), 
		mvColor(cNeutral),
		Subset(0),
		meiDirIndex(0)
	{
				SetOwner(Own);
		InitialRotate(Dir);
		Visible = true;
		MovedThisTurn = false;
		RotatedThisTurn = false;

	};
	//=====ACCESSORS
	int GetID();
	float GetX();
	float GetY();
	float GetZ();
	int GetDir()				{return meiDirIndex;};
	DWORD GetSubset()			{return Subset;};
	D3DXVECTOR3 GetRotation()	{return mvRotation;};
	int GetOwner()				{return miOwner;};
	bool isVisible()			{return Visible;};

	//=====POSITION
	void SetPiece();
	void ResetPiece();
	void Move(int Direction);

	//=====ROTATION
	float DegToRad(float Deg);
	void  RotateCClockwise();
	void  RotateClockWise();

	void SetVisibility(bool V);
};
typedef vector<BaseDrawable*> DrawList;